<template>
  <div>
    <div class="SearchSelector">
      <!-- 品牌 -->
      <div class="c-breadcrumbs">
        <div class="top">品牌</div>
        <div
          class="breadcrumbs"
          v-for="tarde in trademarkList"
          :key="tarde.tmId"
          @click="searchForTrademark(tarde)"
        >
          <p>{{ tarde.tmName }}</p>
        </div>
        <div class="crumbs">+多选</div>
      </div>
      <!-- 平台属性 -->
      <div
        class="c-breadcrumbs"
        v-for="(attr, index) in attrsList"
        :key="attr.attrId"
      >
        <div class="top">{{ attr.attrName }}</div>
        <div
          class="breadcrumbs"
          v-for="(attrvalue, index) in attr.attrValueList"
          :key="index"
          @click="searchForProp(attr, attrvalue)"
        >
          <p>{{ attrvalue }}</p>
        </div>
        <div class="crumbs">+多选</div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  name: "SearchSelector",
  methods: {
    searchForTrademark(tarde) {
      // this.$emit('searchForTrademarka',tarde);
      // console.log(this.$emit('searchForTrademark'))
      this.$emit('searchForTrademark1',tarde)
    },
    searchForProp(attr, attrvalue) {
      this.$emit('searchForProp',attr,attrvalue)
    },
  },
  computed: {
    ...mapGetters(["attrsList", "trademarkList"]),
  },
};
</script>

<style lang="less" scoped>
.SearchSelector {
  width: 1200px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  .c-breadcrumbs {
    position: relative;
    width: 100%;
    height: 50px;
    display: flex;
    line-height: 50px;
    border-bottom: 1px solid #ccc;
    position: relative;
    .top {
      margin-left: 10px;
    }
    .breadcrumbs {
      p {
        margin: 0 15px;
      }
    }
    .crumbs {
      position: absolute;
      right: 0;
      top: 0;
      width: 40px;
      height: 20px;
      line-height: 20px;
      text-align: center;
      margin-top: 15px;
      margin-right: 5px;
      border-radius: 5px;
      border: 1px solid #ccc;
      box-sizing: border-box;
    }
  }
}
</style>
